% Input correlations into MATLAB manually as compareACEcorr %%%% For significance: testing of random sets of same size % Test 1000 random sets and calculate EC for each for current set % size setsizes = [3;6;15;28;45;78;105;210]; MC = zeros(10000000, length(setsizes)); count = 0; for s = 1:length(setsizes) size = setsizes(s) count = count+1; for trial = 1:10000000 trial; % Select random correlation data indices = round(rand(size, 1).*(length(compareACEcorr)-1))+1; correlations = compareACEcorr(indices); % Calculate correlation at top 5% of all TFs and input here: D = 0.512; % Find the number of pairs in test set with correlation greater % than this cutoff p = length(find(correlations > D)); % Motif coherence is the pairs above threshold / total pairs MC(trial, count) = p/length(correlations); end end % Enter experimental MC for each structural class with [set size MC] to % evaluate significance expMC = [28 0.071428571 78 0.115384615 105 0.133333333 6 0.166666667 6 0.166666667 210 0.195238095 15 0.2 15 0.2 78 0.282051282 45 0.311111111 3 0.333333333 3 0.333333333 3 0.333333333 3 0.333333333 6 0.5 15 0.533333333 15 0.8 ]; % Find pval = fraction of random sets of same set size with MC > % test set for i =1:length(expMC(:,1)) setsize = expMC(i, 1); testMC = expMC(i,2); randcol = find(setsizes == setsize); pval_more(i) = length(find(MC(:,randcol)>=testMC))/10000000; end pval_more